const mongoose = require('mongoose')
const schema = new mongoose.Schema({
    name: {
        type: String,
        required: true
    },
    username: {
        type: String,
        ref: 'User',
        required: true
    }
}, {
    toJSON: {
        virtuals: true
    }
})
schema.virtual('tobills', {
    localField: '_id',
    foreignField: 'bossId',
    justOne: false,
    ref: 'Bill'
})

module.exports = mongoose.model('Boss', schema)